<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../index.css">
</head>
<body>
<div class="header">
    <h1>ul渲染</h1>
</div>
<div class="vue-test-container">
    <div id="example"></div>
</div>
<script src="../../dist/v1.1.js"></script>
<script>
// 创建非文本节点
var c = function(tag, children) {
    if (children) {
        for (var i = 0; i < children.length; ++i) {
            var c = children[i];
            if (typeof c == "string") {
                children = t(c);
            }
        }
    }
    return new VNode(tag, children, undefined, null)
}
// 创建文本节点
var t = function (text) {
    return new VNode(null, [], text, null)
}

var container = document.getElementById("example");
var oldVNode = new VNode(container.tagName, [], undefined, container);

var render = function (newVNode) {
    patch(oldVNode, newVNode);
    oldVNode = newVNode;
}

render(c("ul", [
    c("li", [t("item 1")]),
    c("li", [t("item 2")]),
    c("li", [t("item 3")]),
]))
</script>
</body>
</html>
